package cn.ycbjie.ycaudioplayer.newpack.linkagescroll.myapplication;

import android.app.Application;

import com.synjones.minnovate.frame.basesdk.auth.SynBaseSDK;
import com.synjones.minnovate.frame.basesdk.http.interceptor.LogInterceptor;

import java.util.concurrent.TimeUnit;

import cn.ycbjie.ycaudioplayer.newpack.linkagescroll.iapiserver.HeaderInterceptor;
import okhttp3.OkHttpClient;

/**
 * Created by yuyu on 2018-11-08.
 */

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        LogInterceptor logInterceptor = new LogInterceptor();
        logInterceptor.setLevel(LogInterceptor.Level.BODY);
        OkHttpClient client = new OkHttpClient.Builder()
                //添加日志拦截器
                .connectTimeout(20, TimeUnit.SECONDS)
                .readTimeout(120, TimeUnit.SECONDS)//设置读取超时时间
                .writeTimeout(120, TimeUnit.SECONDS)//设置写的超时时间
                //添加网络拦截器
                .addInterceptor(new HeaderInterceptor())
                .addInterceptor(logInterceptor)
                .build();
        new SynBaseSDK.Builder(getApplicationContext())
                //是否需要鉴权  鉴权成功之后 跳转activity  重新鉴权校验时间 单位小时
                .auth(false,"com.example.linkagescroll.syn_main",24)
                //.log(BuildConfig.LOG_DEBUG, Environment.getExternalStorageDirectory())
                .http(client,"http://mobile.weather.com.cn/")
                .external()
                .build();
    }
}
